a = []
b = input()
for i in b:
    if i == '(':
        a.append(i)
    if i == '{':
        a.append(i)
    if i == '[':
        a.append(i)
    if i == '<':
            a.append(i)
    if len(a) > 0 and i == ')' and a[-1] == '(':
        a.pop()
    if len(a) > 0 and i == '}' and a[-1] == '{':
        a.pop()
    if len(a) > 0 and i == ']' and a[-1] == '[':
        a.pop()
    if len(a) > 0 and i == '>' and a[-1] == '<':
        a.pop()
if len(a) > 0:
    print('False')
else:
    print('True')